package server

import (
	"cache-server-demo/cache"
	"net/http"
)

type HttpServer struct {
	cache.Cache
}

func (h *HttpServer) Listen() {
	http.Handle("/cache/", h.cacheHandler())
	http.Handle("/status", h.statusHandler())
	err := http.ListenAndServe(":12345", nil)
	if err != nil {
		return
	}
}

func New(c cache.Cache) *HttpServer {
	return &HttpServer{c}
}
